from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
from django.contrib.auth.models import Permission, ContentType,Group
from meiduo_admin.serializers.admin import UserSerializer, GroupSerializer
from meiduo_admin.utils import PageNum1
from users.models import User


class UserViewSet(ModelViewSet):
    queryset = User.objects.filter(is_staff=True)
    serializer_class = UserSerializer
    pagination_class = PageNum1

    def simple(self, request):
        data = Group.objects.all()
        ser = GroupSerializer(data, many=True)
        return Response(ser.data)

